<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

<ui:composition template="../../template.xhtml">
	<ui:define name="content">
	
	<rich:panel>
	<f:facet name="header">
		<h:outputText value="#{usersEditorBean.title}" />
	</f:facet>
	
	<h:form>
	<h:messages />
   	<h:panelGrid columns="3">
    	<h:outputText value="Name:" />
    	<h:inputText id="name" required="true" value="#{usersEditorBean.userName}" requiredMessage="Name is required.">
    		<f:validator validatorId="usernameValidator"/>
    	</h:inputText>
    	<rich:message for="name" />
    	<h:outputText value="Password:" />
    	<h:inputText id="password" value="#{usersEditorBean.userPassword}" required="true" requiredMessage="Password is required."/>
    	<rich:message for="password" />
    	<h:outputText value="Role:" />
    	<rich:select id="role" value="#{usersEditorBean.userRole}" required="true" requiredMessage="Role is required.">
    		<f:selectItem itemValue="ADM" itemLabel="Admin (ADM)" />
    		<f:selectItem itemValue="PRC" itemLabel="Economic worker (PRC)" />
    		<f:selectItem itemValue="SKL" itemLabel="Warehouse worker (SKL)" />
    	</rich:select>
    	<rich:message for="role" />
    </h:panelGrid>
    <a4j:commandButton value="Save" action="#{usersEditorBean.save}" /> 
	<a4j:commandButton value="Cancel" immediate="true" action="#{usersEditorBean.cancel}" />
    </h:form>
    
    </rich:panel>
	</ui:define>
</ui:composition>
</html>